Skip to content

fix: add logging to silent try-catch blocks#234

Merged
codebutler merged 1 commit intomasterfrom
fix-silent-try-catch-logging
Feb 17, 2026
Merged

fix: add logging to silent try-catch blocks#234
codebutler merged 1 commit intomasterfrom
fix-silent-try-catch-logging

Conversation

@codebutler
Copy link
Owner

Summary

  • Add println() diagnostics to ~30 catch blocks across 18 files that previously swallowed exceptions silently
  • Each log message includes a component tag (e.g. [ISO7816], [CEPAS], [MdST]) and exception details for easy filtering
  • Catch blocks that are legitimately silent (protocol probing, resource cleanup, expected card detection failures) are left unchanged

Files changed

ViewModels: HistoryViewModel, KeysViewModel — log + stacktrace on card/key loading failures
MdST reader: station decode and header parse failures
LocalStorage persisters: deserialization failures (web)
Transit factories: Leap identity, ERG metadata, China hex date parse failures
ISO7816: card reader (records, binary, balance, KSX6924), protocol, TLV decode
CEPAS: purse and history read failures
FeliCa: PCSC and PN533 transceive failures
Other: Vicinity system info, KSX6924 date parsing, ISO7816Dispatcher, MetrodroidJsonParser

Test plan

  • Verify build succeeds (./gradlew assemble)
  • Verify tests pass (./gradlew allTests)
  • Scan a card and check console for any new log output on success (should be quiet)
  • Test with an invalid/corrupted card dump to verify error messages appear

🤖 Generated with Claude Code

Add println() diagnostics to ~30 catch blocks that previously swallowed
exceptions silently, making debugging impossible. Each log message
includes a component tag (e.g. [ISO7816], [CEPAS], [MdST]) and the
exception details.

Categories of changes:
- ViewModels: log + stacktrace when card/key loading fails
- MdST station reader: log parse and decode failures
- LocalStorage persisters: log deserialization failures
- Transit factories: log identity/metadata parse failures
- ISO7816 card reader: log record, binary, balance, and file read failures
- ISO7816 protocol: log unexpected errors in selectByName
- ISO7816 TLV: log recursive build and decode failures
- CEPAS protocol: log purse and history read failures
- FeliCa adapters: log transceive failures
- Vicinity reader: log system info read failures
- KSX6924: log hex date/datetime parse failures

Catch blocks that are legitimately silent (protocol probing, resource
cleanup, expected card detection failures) are left unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codebutler codebutler merged commit 2ebd286 into master Feb 17, 2026
6 checks passed
@codebutler codebutler deleted the fix-silent-try-catch-logging branch February 17, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments